package org.huangjie.controller;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.huangjie.task.Tasks;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author Huang Jie
 * @date 2024/05/18
 */
@Slf4j
@Controller
@AllArgsConstructor
public class IndexController {

    private final Tasks tasks;

    @GetMapping("/")
    public String hello(Model model) {
        return "index";
    }

    @GetMapping("/refresh")
    public String refresh(Model model) {
        tasks.sync();
        return "index";
    }
}
